
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class TmsStoreGroupServiceImpl implements TmsStoreGroupService  {

    @Resource
    private TmsStoreGroupMapper tmsStoreGroupMapper;

    /**
     * 获取 TmsStoreGroup 分页列表
     */
    @Transactional
    public IPage getTmsStoreGroupPagination( PaginationVo paginationVo, TmsStoreGroupQuery tmsStoreGroupQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<TmsStoreGroupEntity> lqs = new LambdaQueryWrapper();
        tmsStoreGroupMapper.selectPage(page, lqs);

        List<TmsStoreGroupEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 TmsStoreGroup 所有数据
     *
    */
    @Transactional
    public List<TmsStoreGroupEntity> getTmsStoreGroupAllList( TmsStoreGroupQuery tmsStoreGroupQuery ) throws Exception {

        LambdaQueryWrapper<TmsStoreGroupEntity> lqs = new LambdaQueryWrapper();
        List<TmsStoreGroupEntity> list = tmsStoreGroupMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 TmsStoreGroup 详情
    */
    @Transactional
    public TmsStoreGroupEntity getTmsStoreGroupDetail( Long id) throws Exception {

        TmsStoreGroupEntity tmsStoreGroup = tmsStoreGroupMapper.selectById(id);
        return tmsStoreGroup;
    }


    /**
     * 新增 TmsStoreGroup
     * */
    @Transactional
    public void addTmsStoreGroup(TmsStoreGroupVo tmsStoreGroupVo) throws Exception {

        TmsStoreGroupEntity tmsStoreGroup = new TmsStoreGroupEntity();
        ReflectionCopy.copyProperties( tmsStoreGroup, tmsStoreGroupVo );
        tmsStoreGroupMapper.insert(tmsStoreGroup);
        return;
    }


    /**
     * 更新 TmsStoreGroup
     * */
    @Transactional
    public void updateTmsStoreGroup( TmsStoreGroupVo tmsStoreGroupVo) throws Exception {

        if( tmsStoreGroupVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        TmsStoreGroupEntity tmsStoreGroup = new TmsStoreGroupEntity();
        ReflectionCopy.copyProperties( tmsStoreGroup, tmsStoreGroupVo );
        tmsStoreGroupMapper.updateById(tmsStoreGroup);
        return;
    }

    /**
     * 删除 TmsStoreGroup
     * */
    @Transactional
    public void batchRemoveTmsStoreGroup( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        tmsStoreGroupMapper.deleteBatchIds(ids);
    }

}

      